﻿using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp.AspNetCore.Mvc;
using YAPACS.RisServer.Abstractions;
using YAPACS.RisServer.Services.Dtos;

namespace YAPACS.RisServer.Controllers;
[Authorize]
public class StudyController : AbpControllerBase
{
    private readonly IStudyService _studyService;

    public StudyController(IStudyService studyService)
    {
        _studyService = studyService;
    }
    [HttpPost("/api/[controller]/get-list")]
    public async Task<IActionResult> GetStudies([FromBody] DataGridRequest request)
    {
        var result = await _studyService.GetStudiesAsync(request);
        return Ok(result);
    }
    [HttpPost("/api/study/create-study-exam")]
    public async Task<IActionResult> CreateStudyExam([FromForm] IList<Guid> studyIds)
    {
        var result = await _studyService.CreateStudyExamAsync(studyIds);
        return Ok(result);
    }
    [HttpPost("/api/study/apply-consultation")]
    public async Task<IActionResult> ApplyConsultation([FromBody] Input input)
    {
        var result = await _studyService.ApplyConsultationAsync(input.ExamIds);
        return Ok(result);
    }
}
